#include <iostream>
using namespace std;

class Time {

    public:
        int hours;      // 小时
        int minutes;    // 分钟

        Time() {
            hours = 0;
            minutes = 0;
        }

        Time(int h, int m) {
            this->hours = h;
            this->minutes = m;
        }

        void show() {
            cout << hours << " " << minutes << endl;
        }

        
    //    friend Time operator+(const Time &t1,const Time &t2){
    //         Time t3;
    //         t3.hours=t1.hours+t2.hours;
    //         t3.minutes=t1.minutes+t2.minutes;

    //         if(t3.minutes>=60)
    //         {
    //             t3.hours++;
    //             t3.minutes-=60;
    //         }        
    // return t3;
    //       }

         Time operator+(const Time &t2){
            Time t3;
            t3.hours=this->hours+t2.hours;
            t3.minutes=this->minutes+t2.minutes;

            if(t3.minutes>=60)
            {
                t3.hours++;
                t3.minutes-=60;
            }        
    return t3;
          }
};

int main() {

    int h, m;
    cin >> h;
    cin >> m;

    Time t1(h, m);
    Time t2(2, 20);

    Time t3 = t1 + t2;
    t3.show();
    
    return 0;
}